import request from '@/config/axios'

// MQTT水监控 VO
export interface SubscribeWaterVO {
  id: number // 主键ID
  deviceId: number // 设备ID
  mqttConfigId: number // MQTT配置ID
  topic: string // 主题
  payloadWd: string // 温度
  payloadZd: string // 浊度
  payloadYl: string // 余氯
  payloadPh: string // pH值
  payload: string // 消息内容
  qos: number // 服务质量
  retained: boolean // 是否保留消息
  direction: string // 消息方向
  clientId: string // 客户端ID
  messageId: string // 消息ID
  timestamp: Date // 时间戳
}

// MQTT水监控 API
export const SubscribeWaterApi = {
  // 查询MQTT水监控分页
  getSubscribeWaterPage: async (params: any) => {
    return await request.get({ url: `/mqtt/subscribe-water/page`, params })
  },

  // 查询MQTT水监控详情
  getSubscribeWater: async (id: number) => {
    return await request.get({ url: `/mqtt/subscribe-water/get?id=` + id })
  },

  // 新增MQTT水监控
  createSubscribeWater: async (data: SubscribeWaterVO) => {
    return await request.post({ url: `/mqtt/subscribe-water/create`, data })
  },

  // 修改MQTT水监控
  updateSubscribeWater: async (data: SubscribeWaterVO) => {
    return await request.put({ url: `/mqtt/subscribe-water/update`, data })
  },

  // 删除MQTT水监控
  deleteSubscribeWater: async (id: number) => {
    return await request.delete({ url: `/mqtt/subscribe-water/delete?id=` + id })
  },

  // 导出MQTT水监控 Excel
  exportSubscribeWater: async (params) => {
    return await request.download({ url: `/mqtt/subscribe-water/export-excel`, params })
  },
}